<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" data-whc_version="25.0">
    <head><link rel="shortcut icon" href="../../../oxygen-webhelp/template/images/favicon.png"/><link rel="icon" href="../../../oxygen-webhelp/template/images/favicon.png"/><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="copyright" content="(C) Copyright 2024"/><meta name="generator" content="DITA-OT"/><meta name="description" content="You can configure the Kafka Consumer and Kafka Multitopic Consumer origin s to capture the message keys included in each Kafka message and store them in generated records. Kafka message keys can be ..."/><meta name="prodname" content="Data Collector"/><meta name="version" content="3"/><meta name="release" content="16"/><meta name="modification" content="0"/>        
      <title>Kafka Message Keys</title><!--  Generated with Oxygen version 25.1, build number 2023042410.  --><meta name="wh-path2root" content="../../../"/><meta name="wh-toc-id" content="concept_ujc_cml_smb-d16893e12549"/><meta name="wh-source-relpath" content="datacollector/UserGuide/Pipeline_Configuration/KMessageKey.dita"/><meta name="wh-out-relpath" content="datacollector/UserGuide/Pipeline_Configuration/KMessageKey.html"/>

    <link rel="stylesheet" type="text/css" href="../../../oxygen-webhelp/app/commons.css?buildId=2023042410"/>
    <link rel="stylesheet" type="text/css" href="../../../oxygen-webhelp/app/topic.css?buildId=2023042410"/>

    <script src="../../../oxygen-webhelp/app/options/properties.js?buildId=20240802104629"></script>
    <script src="../../../oxygen-webhelp/app/localization/strings.js?buildId=2023042410"></script>
    <script src="../../../oxygen-webhelp/app/search/index/keywords.js?buildId=20240802104629"></script>
    <script defer="defer" src="../../../oxygen-webhelp/app/commons.js?buildId=2023042410"></script>
    <script defer="defer" src="../../../oxygen-webhelp/app/topic.js?buildId=2023042410"></script>
<link rel="stylesheet" type="text/css" href="../../../oxygen-webhelp/template/light.css?buildId=2023042410"/><link rel="stylesheet" type="text/css" href="../../../skin.css"/></head>

    <body class="wh_topic_page frmBody">
        
        
        

        
<nav class="navbar navbar-default wh_header" data-whc_version="25.0">
    <div class="container-fluid">
        <div class="wh_header_flex_container navbar-nav navbar-expand-md navbar-dark">
            <div class="wh_logo_and_publication_title_container">
                <div class="wh_logo_and_publication_title">
                    
                    <!--
                            This component will be generated when the next parameters are specified in the transformation scenario:
                            'webhelp.logo.image' and 'webhelp.logo.image.target.url'.
                            See: http://oxygenxml.com/doc/versions/17.1/ug-editor/#topics/dita_webhelp_output.html.
                    -->
                    
                    <div class=" wh_publication_title "><a href="../../../index.html"><span class="booktitle">  <span class="ph mainbooktitle"><span class="ph">Data Collector</span> User Guide</span>  </span></a></div>
                    
                </div>
                
                <!-- The menu button for mobile devices is copied in the output only when the 'webhelp.show.top.menu' parameter is set to 'yes' -->
                
            </div>

            <div class="wh_top_menu_and_indexterms_link collapse navbar-collapse">
                
                
                <div class=" wh_indexterms_link "><a href="../../../indexTerms.html" title="Index" aria-label="Go to index terms page"><span>Index</span></a></div>
                
            </div>
        </div>
    </div>
</nav>

        <div class=" wh_search_input navbar-form wh_topic_page_search search " role="form">


<form id="searchForm" method="get" role="search" action="../../../search.html"><div><input type="search" placeholder="Search " class="wh_search_textfield" id="textToSearch" name="searchQuery" aria-label="Search query" required="required"/><button type="submit" class="wh_search_button" aria-label="Search"><span class="search_input_text">Search</span></button></div></form>

</div>
        
        <div class="container-fluid">
            <div class="row">

                <nav class="wh_tools d-print-none">
                    
<div data-tooltip-position="bottom" class=" wh_breadcrumb "><ol class="d-print-none"><li><span class="home"><a href="../../../index.html"><span>Home</span></a></span></li><li><div class="topicref" data-id="concept_qn1_wn4_kq"><div class="title"><a href="../../../datacollector/UserGuide/Pipeline_Configuration/PipelineConfiguration_title.html">Pipeline Configuration</a></div></div></li><li class="active"><div class="topicref" data-id="concept_ujc_cml_smb"><div class="title"><a href="../../../datacollector/UserGuide/Pipeline_Configuration/KMessageKey.html#concept_ujc_cml_smb">Kafka Message Keys</a><div class="wh-tooltip"><p class="shortdesc"></p></div></div></div></li></ol></div>



                    <div class="wh_right_tools "><button class="wh_hide_highlight" aria-label="Toggle search highlights" title="Toggle search highlights"></button><button class="webhelp_expand_collapse_sections" data-next-state="collapsed" aria-label="Collapse sections" title="Collapse sections"></button><div class=" wh_navigation_links "><span id="topic_navigation_links" class="navheader">
  
<span class="navprev"><a class="- topic/link link" href="../../../datacollector/UserGuide/Pipeline_Configuration/KafkaSecurity.html#concept_jpy_ln5_klb" title="Security in Kafka Stages" aria-label="Previous topic: Security in Kafka Stages" rel="prev"></a></span>  
<span class="navnext"><a class="- topic/link link" href="../../../datacollector/UserGuide/Pipeline_Configuration/SalesforceAuth.html#concept_fgb_tkd_z4b" title="Authentication in Salesforce Stages" aria-label="Next topic: Authentication in Salesforce Stages" rel="next"></a></span>  </span></div>
<!--External resource link-->
<div class=" wh_print_link print d-none d-md-inline-block "><button onClick="window.print()" title="Print this page" aria-label="Print this page"></button></div>
                        
                        
                        
                        
                    </div>
                </nav>
            </div>

            

<div class="wh_content_area">
                <div class="row">
                    


                        <nav role="navigation" id="wh_publication_toc" class="col-lg-3 col-md-3 col-sm-12 d-md-block d-none d-print-none">
<div id="wh_publication_toc_content">


                            <div class=" wh_publication_toc " data-tooltip-position="right"><span class="expand-button-action-labels"><span id="button-expand-action" role="button" aria-label="Expand"></span><span id="button-collapse-action" role="button" aria-label="Collapse"></span><span id="button-pending-action" role="button" aria-label="Pending"></span></span><ul role="tree" aria-label="Table of Contents"><li role="treeitem" aria-expanded="false"><div data-tocid="concept_htw_ghg_jq-d16893e53" class="topicref" data-id="concept_htw_ghg_jq" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action concept_htw_ghg_jq-d16893e53-link" class="wh-expand-btn"></span><div class="title"><a href="../../../datacollector/UserGuide/Getting_Started/GettingStarted_Title.html#concept_htw_ghg_jq" id="concept_htw_ghg_jq-d16893e53-link">Getting Started</a></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="concept_l2v_nlp_mpb-d16893e331" class="topicref" data-id="concept_l2v_nlp_mpb" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action concept_l2v_nlp_mpb-d16893e331-link" class="wh-expand-btn"></span><div class="title"><a href="../../../datacollector/UserGuide/ReleaseNotes/ReleaseNotes.html#concept_l2v_nlp_mpb" id="concept_l2v_nlp_mpb-d16893e331-link">Release Notes</a></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="concept_l4q_flb_kr-d16893e2582" class="topicref" data-id="concept_l4q_flb_kr" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action concept_l4q_flb_kr-d16893e2582-link" class="wh-expand-btn"></span><div class="title"><a href="../../../datacollector/UserGuide/Installation/Install_title.html" id="concept_l4q_flb_kr-d16893e2582-link">Installation</a></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="concept_ylh_yyz_ky-d16893e3984" class="topicref" data-id="concept_ylh_yyz_ky" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action concept_ylh_yyz_ky-d16893e3984-link" class="wh-expand-btn"></span><div class="title"><a href="../../../datacollector/UserGuide/Configuration/Config_title.html" id="concept_ylh_yyz_ky-d16893e3984-link">Configuration</a></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="concept_ejk_f1f_5v-d16893e7058" class="topicref" data-id="concept_ejk_f1f_5v" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action concept_ejk_f1f_5v-d16893e7058-link" class="wh-expand-btn"></span><div class="title"><a href="../../../datacollector/UserGuide/Upgrade/Upgrade_title.html" id="concept_ejk_f1f_5v-d16893e7058-link">Upgrade</a></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="concept_qsw_cjy_bt-d16893e10103" class="topicref" data-id="concept_qsw_cjy_bt" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action concept_qsw_cjy_bt-d16893e10103-link" class="wh-expand-btn"></span><div class="title"><a href="../../../datacollector/UserGuide/Pipeline_Design/PipelineDesign_title.html" id="concept_qsw_cjy_bt-d16893e10103-link">Pipeline Concepts and Design</a></div></div></li><li role="treeitem" aria-expanded="true"><div data-tocid="concept_qn1_wn4_kq-d16893e11199" class="topicref" data-id="concept_qn1_wn4_kq" data-state="expanded"><span role="button" tabindex="0" aria-labelledby="button-collapse-action concept_qn1_wn4_kq-d16893e11199-link" class="wh-expand-btn"></span><div class="title"><a href="../../../datacollector/UserGuide/Pipeline_Configuration/PipelineConfiguration_title.html" id="concept_qn1_wn4_kq-d16893e11199-link">Pipeline Configuration</a></div></div><ul role="group" class="navbar-nav nav-list"><li role="treeitem"><div data-tocid="concept_izr_f2p_rq-d16893e11221" class="topicref" data-id="concept_izr_f2p_rq" data-state="leaf"><span role="button" class="wh-expand-btn"></span><div class="title"><a href="../../../datacollector/UserGuide/Pipeline_Configuration/DataCollectorUI-Config.html#concept_izr_f2p_rq" id="concept_izr_f2p_rq-d16893e11221-link">Data Collector UI - Edit Mode</a><div class="wh-tooltip"><p class="shortdesc"></p></div></div></div></li><li role="treeitem"><div data-tocid="concept_mjg_ly5_pgb-d16893e11245" class="topicref" data-id="concept_mjg_ly5_pgb" data-state="leaf"><span role="button" class="wh-expand-btn"></span><div class="title"><a href="../../../datacollector/UserGuide/Pipeline_Configuration/ProductIcons_Doc.html" id="concept_mjg_ly5_pgb-d16893e11245-link">Pipeline Types and Icons in Documentation</a></div></div></li><li role="treeitem"><div data-tocid="concept_cgm_ktz_2t-d16893e11267" class="topicref" data-id="concept_cgm_ktz_2t" data-state="leaf"><span role="button" class="wh-expand-btn"></span><div class="title"><a href="../../../datacollector/UserGuide/Pipeline_Configuration/Retry.html#concept_cgm_ktz_2t" id="concept_cgm_ktz_2t-d16893e11267-link">Retrying the Pipeline</a><div class="wh-tooltip"><p class="shortdesc"></p></div></div></div></li><li role="treeitem"><div data-tocid="concept_erj_qg4_qv-d16893e11291" class="topicref" data-id="concept_erj_qg4_qv" data-state="leaf"><span role="button" class="wh-expand-btn"></span><div class="title"><a href="../../../datacollector/UserGuide/Pipeline_Configuration/PipelineRateLimit.html#concept_erj_qg4_qv" id="concept_erj_qg4_qv-d16893e11291-link">Rate Limit</a><div class="wh-tooltip"><p class="shortdesc"></p></div></div></div></li><li role="treeitem"><div data-tocid="concept_ddf_hr1_rmb-d16893e11315" class="topicref" data-id="concept_ddf_hr1_rmb" data-state="leaf"><span role="button" class="wh-expand-btn"></span><div class="title"><a href="../../../datacollector/UserGuide/Pipeline_Configuration/AdvancedOptions.html" id="concept_ddf_hr1_rmb-d16893e11315-link">Advanced Options</a></div></div></li><li role="treeitem"><div data-tocid="concept_alb_b3y_cbb-d16893e11337" class="topicref" data-id="concept_alb_b3y_cbb" data-state="leaf"><span role="button" class="wh-expand-btn"></span><div class="title"><a href="../../../datacollector/UserGuide/Pipeline_Configuration/SimpleBulkEdit.html#concept_alb_b3y_cbb" id="concept_alb_b3y_cbb-d16893e11337-link">Simple and Bulk Edit Mode</a><div class="wh-tooltip"><p class="shortdesc"></p></div></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="concept_h5b_kcr_kz-d16893e11361" class="topicref" data-id="concept_h5b_kcr_kz" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action concept_h5b_kcr_kz-d16893e11361-link" class="wh-expand-btn"></span><div class="title"><a href="../../../datacollector/UserGuide/Pipeline_Configuration/RuntimeValues.html#concept_h5b_kcr_kz" id="concept_h5b_kcr_kz-d16893e11361-link">Runtime Values</a><div class="wh-tooltip"><p class="shortdesc"></p></div></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="concept_jcw_n4t_51b-d16893e11738" class="topicref" data-id="concept_jcw_n4t_51b" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action concept_jcw_n4t_51b-d16893e11738-link" class="wh-expand-btn"></span><div class="title"><a href="../../../datacollector/UserGuide/Pipeline_Configuration/EventGeneration.html#concept_jcw_n4t_51b" id="concept_jcw_n4t_51b-d16893e11738-link">Event Generation</a><div class="wh-tooltip"><p class="shortdesc"></p></div></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="concept_mp1_t3l_rz-d16893e11784" class="topicref" data-id="concept_mp1_t3l_rz" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action concept_mp1_t3l_rz-d16893e11784-link" class="wh-expand-btn"></span><div class="title"><a href="../../../datacollector/UserGuide/Pipeline_Configuration/Webhooks.html#concept_mp1_t3l_rz" id="concept_mp1_t3l_rz-d16893e11784-link">Webhooks</a><div class="wh-tooltip"><p class="shortdesc"></p></div></div></div></li><li role="treeitem"><div data-tocid="concept_mtn_k4j_rz-d16893e11874" class="topicref" data-id="concept_mtn_k4j_rz" data-state="leaf"><span role="button" class="wh-expand-btn"></span><div class="title"><a href="../../../datacollector/UserGuide/Pipeline_Configuration/Notifications.html#concept_mtn_k4j_rz" id="concept_mtn_k4j_rz-d16893e11874-link">Notifications</a><div class="wh-tooltip"><p class="shortdesc"></p></div></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="concept_dd1_n3f_5z-d16893e11899" class="topicref" data-id="concept_dd1_n3f_5z" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action concept_dd1_n3f_5z-d16893e11899-link" class="wh-expand-btn"></span><div class="title"><a href="../../../datacollector/UserGuide/Pipeline_Configuration/SSL-TLS.html#concept_dd1_n3f_5z" id="concept_dd1_n3f_5z-d16893e11899-link">SSL/TLS Encryption</a><div class="wh-tooltip"><p class="shortdesc"></p></div></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="concept_ypw_hbj_3nb-d16893e12071" class="topicref" data-id="concept_ypw_hbj_3nb" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action concept_ypw_hbj_3nb-d16893e12071-link" class="wh-expand-btn"></span><div class="title"><a href="../../../datacollector/UserGuide/Pipeline_Configuration/AmazonSecurity.html#concept_ypw_hbj_3nb" id="concept_ypw_hbj_3nb-d16893e12071-link">Security in Amazon Stages</a></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="concept_vl2_bbx_q1b-d16893e12192" class="topicref" data-id="concept_vl2_bbx_q1b" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action concept_vl2_bbx_q1b-d16893e12192-link" class="wh-expand-btn"></span><div class="title"><a href="../../../datacollector/UserGuide/Pipeline_Configuration/GoogleCloud-Credentials.html#concept_vl2_bbx_q1b" id="concept_vl2_bbx_q1b-d16893e12192-link">Security in Google Cloud Stages</a></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="concept_jpy_ln5_klb-d16893e12280" class="topicref" data-id="concept_jpy_ln5_klb" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action concept_jpy_ln5_klb-d16893e12280-link" class="wh-expand-btn"></span><div class="title"><a href="../../../datacollector/UserGuide/Pipeline_Configuration/KafkaSecurity.html#concept_jpy_ln5_klb" id="concept_jpy_ln5_klb-d16893e12280-link">Security in Kafka Stages</a></div></div></li><li role="treeitem" aria-expanded="true" class="active"><div data-tocid="concept_ujc_cml_smb-d16893e12549" class="topicref" data-id="concept_ujc_cml_smb" data-state="expanded"><span role="button" tabindex="0" aria-labelledby="button-collapse-action concept_ujc_cml_smb-d16893e12549-link" class="wh-expand-btn"></span><div class="title"><a href="../../../datacollector/UserGuide/Pipeline_Configuration/KMessageKey.html#concept_ujc_cml_smb" id="concept_ujc_cml_smb-d16893e12549-link">Kafka Message Keys</a><div class="wh-tooltip"><p class="shortdesc"></p></div></div></div><ul role="group" class="navbar-nav nav-list"><li role="treeitem"><div data-tocid="concept_dyb_s4b_5mb-d16893e12573" class="topicref" data-id="concept_dyb_s4b_5mb" data-state="leaf"><span role="button" class="wh-expand-btn"></span><div class="title"><a href="../../../datacollector/UserGuide/Pipeline_Configuration/KMessageKey.html#concept_dyb_s4b_5mb" id="concept_dyb_s4b_5mb-d16893e12573-link">Storing Message Keys</a><div class="wh-tooltip"><p class="shortdesc"></p></div></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="concept_qrp_lmq_smb-d16893e12597" class="topicref" data-id="concept_qrp_lmq_smb" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action concept_qrp_lmq_smb-d16893e12597-link" class="wh-expand-btn"></span><div class="title"><a href="../../../datacollector/UserGuide/Pipeline_Configuration/KMessageKey.html#concept_qrp_lmq_smb" id="concept_qrp_lmq_smb-d16893e12597-link">Message Key Formats</a><div class="wh-tooltip"><p class="shortdesc"></p></div></div></div></li><li role="treeitem"><div data-tocid="concept_kdj_kzf_tmb-d16893e12667" class="topicref" data-id="concept_kdj_kzf_tmb" data-state="leaf"><span role="button" class="wh-expand-btn"></span><div class="title"><a href="../../../datacollector/UserGuide/Pipeline_Configuration/KMessageKey.html#concept_kdj_kzf_tmb" id="concept_kdj_kzf_tmb-d16893e12667-link">Passing Key Values to Kafka</a><div class="wh-tooltip"><p class="shortdesc"></p></div></div></div></li><li role="treeitem"><div data-tocid="concept_jrn_smb_5mb-d16893e12691" class="topicref" data-id="concept_jrn_smb_5mb" data-state="leaf"><span role="button" class="wh-expand-btn"></span><div class="title"><a href="../../../datacollector/UserGuide/Pipeline_Configuration/KMessageKey.html#concept_jrn_smb_5mb" id="concept_jrn_smb_5mb-d16893e12691-link">Example: Storing and Passing Kafka Message Keys</a><div class="wh-tooltip"><p class="shortdesc"></p></div></div></div></li></ul></li><li role="treeitem" aria-expanded="false"><div data-tocid="concept_fgb_tkd_z4b-d16893e12715" class="topicref" data-id="concept_fgb_tkd_z4b" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action concept_fgb_tkd_z4b-d16893e12715-link" class="wh-expand-btn"></span><div class="title"><a href="../../../datacollector/UserGuide/Pipeline_Configuration/SalesforceAuth.html#concept_fgb_tkd_z4b" id="concept_fgb_tkd_z4b-d16893e12715-link">Authentication in Salesforce Stages</a><div class="wh-tooltip"><p class="shortdesc"></p></div></div></div></li><li role="treeitem"><div data-tocid="concept_azs_swf_jr-d16893e12763" class="topicref" data-id="concept_azs_swf_jr" data-state="leaf"><span role="button" class="wh-expand-btn"></span><div class="title"><a href="../../../datacollector/UserGuide/Pipeline_Configuration/Validation.html#concept_azs_swf_jr" id="concept_azs_swf_jr-d16893e12763-link">Implicit and Explicit Validation</a><div class="wh-tooltip"><p class="shortdesc"></p></div></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="concept_ofb_1cm_xq-d16893e12787" class="topicref" data-id="concept_ofb_1cm_xq" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action concept_ofb_1cm_xq-d16893e12787-link" class="wh-expand-btn"></span><div class="title"><a href="../../../datacollector/UserGuide/Pipeline_Configuration/Expressions.html#concept_ofb_1cm_xq" id="concept_ofb_1cm_xq-d16893e12787-link">Expression Configuration</a><div class="wh-tooltip"><p class="shortdesc"></p></div></div></div></li><li role="treeitem"><div data-tocid="task_xlv_jdw_kq-d16893e13032" class="topicref" data-id="task_xlv_jdw_kq" data-state="leaf"><span role="button" class="wh-expand-btn"></span><div class="title"><a href="../../../datacollector/UserGuide/Pipeline_Configuration/ConfiguringAPipeline.html" id="task_xlv_jdw_kq-d16893e13032-link">Configuring a Pipeline</a><div class="wh-tooltip"><p class="shortdesc"></p></div></div></div></li></ul></li><li role="treeitem" aria-expanded="false"><div data-tocid="concept_hdr_gyw_41b-d16893e13057" class="topicref" data-id="concept_hdr_gyw_41b" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action concept_hdr_gyw_41b-d16893e13057-link" class="wh-expand-btn"></span><div class="title"><a href="../../../datacollector/UserGuide/Data_Formats/DataFormats-Title.html" id="concept_hdr_gyw_41b-d16893e13057-link">Data Formats</a><div class="wh-tooltip"><p class="shortdesc"></p></div></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="concept_yjl_nc5_jq-d16893e14164" class="topicref" data-id="concept_yjl_nc5_jq" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action concept_yjl_nc5_jq-d16893e14164-link" class="wh-expand-btn"></span><div class="title"><a href="../../../datacollector/UserGuide/Origins/Origins_title.html" id="concept_yjl_nc5_jq-d16893e14164-link">Origins</a></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="concept_yjl_nc5_jq-d16893e35197" class="topicref" data-id="concept_yjl_nc5_jq" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action concept_yjl_nc5_jq-d16893e35197-link" class="wh-expand-btn"></span><div class="title"><a href="../../../datacollector/UserGuide/Processors/Processors_title.html" id="concept_yjl_nc5_jq-d16893e35197-link">Processors</a></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="concept_agj_cfj_br-d16893e44037" class="topicref" data-id="concept_agj_cfj_br" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action concept_agj_cfj_br-d16893e44037-link" class="wh-expand-btn"></span><div class="title"><a href="../../../datacollector/UserGuide/Destinations/Destinations-title.html" id="concept_agj_cfj_br-d16893e44037-link">Destinations</a></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="concept_umc_1lk_fx-d16893e56072" class="topicref" data-id="concept_umc_1lk_fx" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action concept_umc_1lk_fx-d16893e56072-link" class="wh-expand-btn"></span><div class="title"><a href="../../../datacollector/UserGuide/Executors/Executors-title.html" id="concept_umc_1lk_fx-d16893e56072-link">Executors</a></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="concept_xxd_f5r_kx-d16893e59696" class="topicref" data-id="concept_xxd_f5r_kx" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action concept_xxd_f5r_kx-d16893e59696-link" class="wh-expand-btn"></span><div class="title"><a href="../../../datacollector/UserGuide/Event_Handling/EventFramework-Title.html#concept_xxd_f5r_kx" id="concept_xxd_f5r_kx-d16893e59696-link">Dataflow Triggers</a></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="concept_zq5_pb4_flb-d16893e60134" class="topicref" data-id="concept_zq5_pb4_flb" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action concept_zq5_pb4_flb-d16893e60134-link" class="wh-expand-btn"></span><div class="title"><a href="../../../datacollector/UserGuide/Solutions/Solutions-title.html" id="concept_zq5_pb4_flb-d16893e60134-link">Solutions</a></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="concept_ugp_kwf_xw-d16893e61337" class="topicref" data-id="concept_ugp_kwf_xw" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action concept_ugp_kwf_xw-d16893e61337-link" class="wh-expand-btn"></span><div class="title"><a href="../../../datacollector/UserGuide/DPM/DPM_title.html" id="concept_ugp_kwf_xw-d16893e61337-link">StreamSets Control Hub</a></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="concept_fyf_gkq_4bb-d16893e62693" class="topicref" data-id="concept_fyf_gkq_4bb" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action concept_fyf_gkq_4bb-d16893e62693-link" class="wh-expand-btn"></span><div class="title"><a href="../../../datacollector/UserGuide/Edge_Mode/EdgePipelines_title.html" id="concept_fyf_gkq_4bb-d16893e62693-link"><span class="ph">StreamSets Data Collector Edge</span></a></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="concept_wwq_gxc_py-d16893e63980" class="topicref" data-id="concept_wwq_gxc_py" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action concept_wwq_gxc_py-d16893e63980-link" class="wh-expand-btn"></span><div class="title"><a href="../../../datacollector/UserGuide/Multithreaded_Pipelines/MultithreadedPipelines.html#concept_wwq_gxc_py" id="concept_wwq_gxc_py-d16893e63980-link">Multithreaded Pipelines</a></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="concept_gzw_tdm_p2b-d16893e64187" class="topicref" data-id="concept_gzw_tdm_p2b" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action concept_gzw_tdm_p2b-d16893e64187-link" class="wh-expand-btn"></span><div class="title"><a href="../../../datacollector/UserGuide/Microservice/Microservice_Title.html#concept_gzw_tdm_p2b" id="concept_gzw_tdm_p2b-d16893e64187-link">Microservice Pipelines</a></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="Orchestrators_Title-d16893e64348" class="topicref" data-id="Orchestrators_Title" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action Orchestrators_Title-d16893e64348-link" class="wh-expand-btn"></span><div class="title"><a href="../../../datacollector/UserGuide/Orchestration_Pipelines/OrchestrationPipelines_Title.html#Orchestrators_Title" id="Orchestrators_Title-d16893e64348-link">Orchestration Pipelines</a></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="concept_wr1_ktz_bt-d16893e64489" class="topicref" data-id="concept_wr1_ktz_bt" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action concept_wr1_ktz_bt-d16893e64489-link" class="wh-expand-btn"></span><div class="title"><a href="../../../datacollector/UserGuide/RPC_Pipelines/SDC_RPCpipelines_title.html#concept_wr1_ktz_bt" id="concept_wr1_ktz_bt-d16893e64489-link">SDC RPC Pipelines</a></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="concept_fpz_5r4_vs-d16893e64679" class="topicref" data-id="concept_fpz_5r4_vs" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action concept_fpz_5r4_vs-d16893e64679-link" class="wh-expand-btn"></span><div class="title"><a href="../../../datacollector/UserGuide/Cluster_Mode/ClusterPipelines_title.html" id="concept_fpz_5r4_vs-d16893e64679-link">Cluster Pipelines</a></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="concept_jjk_23z_sq-d16893e65172" class="topicref" data-id="concept_jjk_23z_sq" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action concept_jjk_23z_sq-d16893e65172-link" class="wh-expand-btn"></span><div class="title"><a href="../../../datacollector/UserGuide/Data_Preview/DataPreview_Title.html#concept_jjk_23z_sq" id="concept_jjk_23z_sq-d16893e65172-link">Data Preview</a></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="concept_pgk_brx_rr-d16893e65458" class="topicref" data-id="concept_pgk_brx_rr" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action concept_pgk_brx_rr-d16893e65458-link" class="wh-expand-btn"></span><div class="title"><a href="../../../datacollector/UserGuide/Alerts/RulesAlerts_title.html#concept_pgk_brx_rr" id="concept_pgk_brx_rr-d16893e65458-link">Rules and Alerts</a></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="concept_asx_fdz_sq-d16893e65960" class="topicref" data-id="concept_asx_fdz_sq" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action concept_asx_fdz_sq-d16893e65960-link" class="wh-expand-btn"></span><div class="title"><a href="../../../datacollector/UserGuide/Pipeline_Monitoring/PipelineMonitoring_title.html#concept_asx_fdz_sq" id="concept_asx_fdz_sq-d16893e65960-link">Pipeline Monitoring</a></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="concept_o3l_dtr_5q-d16893e66304" class="topicref" data-id="concept_o3l_dtr_5q" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action concept_o3l_dtr_5q-d16893e66304-link" class="wh-expand-btn"></span><div class="title"><a href="../../../datacollector/UserGuide/Pipeline_Maintenance/PipelineMaintenance_title.html#concept_o3l_dtr_5q" id="concept_o3l_dtr_5q-d16893e66304-link">Pipeline Maintenance</a></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="concept_yms_ftm_sq-d16893e66768" class="topicref" data-id="concept_yms_ftm_sq" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action concept_yms_ftm_sq-d16893e66768-link" class="wh-expand-btn"></span><div class="title"><a href="../../../datacollector/UserGuide/Administration/Administration_title.html#concept_yms_ftm_sq" id="concept_yms_ftm_sq-d16893e66768-link">Administration</a></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="concept_nls_w1r_ks-d16893e67508" class="topicref" data-id="concept_nls_w1r_ks" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action concept_nls_w1r_ks-d16893e67508-link" class="wh-expand-btn"></span><div class="title"><a href="../../../datacollector/UserGuide/Tutorial/Tutorial-title.html" id="concept_nls_w1r_ks-d16893e67508-link">Tutorial</a></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="concept_sh3_frm_tq-d16893e68001" class="topicref" data-id="concept_sh3_frm_tq" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action concept_sh3_frm_tq-d16893e68001-link" class="wh-expand-btn"></span><div class="title"><a href="../../../datacollector/UserGuide/Troubleshooting/Troubleshooting_title.html#concept_sh3_frm_tq" id="concept_sh3_frm_tq-d16893e68001-link">Troubleshooting</a></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="concept_xbx_rs1_tq-d16893e68798" class="topicref" data-id="concept_xbx_rs1_tq" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action concept_xbx_rs1_tq-d16893e68798-link" class="wh-expand-btn"></span><div class="title"><a href="../../../datacollector/UserGuide/Glossary/Glossary_title.html#concept_xbx_rs1_tq" id="concept_xbx_rs1_tq-d16893e68798-link">Glossary</a></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="concept_jn1_nzb_kv-d16893e68843" class="topicref" data-id="concept_jn1_nzb_kv" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action concept_jn1_nzb_kv-d16893e68843-link" class="wh-expand-btn"></span><div class="title"><a href="../../../datacollector/UserGuide/Apx-DataFormats/DataFormat_Title.html#concept_jn1_nzb_kv" id="concept_jn1_nzb_kv-d16893e68843-link">Data Formats by Stage</a><div class="wh-tooltip"><p class="shortdesc"></p></div></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="concept_pvm_yt3_wq-d16893e68958" class="topicref" data-id="concept_pvm_yt3_wq" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action concept_pvm_yt3_wq-d16893e68958-link" class="wh-expand-btn"></span><div class="title"><a href="../../../datacollector/UserGuide/Expression_Language/ExpressionLanguage_title.html" id="concept_pvm_yt3_wq-d16893e68958-link">Expression Language</a></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="concept_vcj_1ws_js-d16893e69669" class="topicref" data-id="concept_vcj_1ws_js" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action concept_vcj_1ws_js-d16893e69669-link" class="wh-expand-btn"></span><div class="title"><a href="../../../datacollector/UserGuide/Apx-RegEx/RegEx-Title.html#concept_vcj_1ws_js" id="concept_vcj_1ws_js-d16893e69669-link">Regular Expressions</a></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="concept_chv_vmj_wr-d16893e69787" class="topicref" data-id="concept_chv_vmj_wr" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action concept_chv_vmj_wr-d16893e69787-link" class="wh-expand-btn"></span><div class="title"><a href="../../../datacollector/UserGuide/Apx-GrokPatterns/GrokPatterns_title.html#concept_chv_vmj_wr" id="concept_chv_vmj_wr-d16893e69787-link">Grok Patterns</a></div></div></li></ul></div>
                        

</div>
</nav>
                    


                    
                    <div id="wh_topic_body" class="col-lg-7 col-md-9 col-sm-12">
<button id="wh_close_publication_toc_button" class="close-toc-button d-none" aria-label="Toggle publishing table of content" aria-controls="wh_publication_toc" aria-expanded="true"><span class="close-toc-icon-container"><span class="close-toc-icon"></span></span></button><button id="wh_close_topic_toc_button" class="close-toc-button d-none" aria-label="Toggle topic table of content" aria-controls="wh_topic_toc" aria-expanded="true"><span class="close-toc-icon-container"><span class="close-toc-icon"></span></span></button>

                        
<div class=" wh_topic_content body "><main role="main"><article class="" role="article" aria-labelledby="ariaid-title1"><article class="nested0" aria-labelledby="ariaid-title1" id="concept_ujc_cml_smb">
    <h1 class="- topic/title title topictitle1" id="ariaid-title1">Kafka Message Keys</h1>
    
    <div class="- topic/body concept/conbody body conbody"><p class="- topic/shortdesc shortdesc"></p>
        <p class="- topic/p p">You can configure the <span class="- topic/ph ph">Kafka Consumer and </span>Kafka Multitopic Consumer origin<span class="- topic/ph ph">s</span> to capture the message keys included in each Kafka message and
            store them in generated records. Kafka message keys can be string values or Avro
            messages, depending on how your Kafka system is configured. </p>
        <p class="- topic/p p">Store message key values in a record when you want to use the values in pipeline
            processing logic or to write them to destination systems. When you store message key
            values, you can also configure a Kafka Producer destination to pass those values to
            Kafka as Kafka message keys. This allows Kafka to reuse the original message keys
            instead of generating new message keys for the data.</p>
        <p class="- topic/p p">If you have no need for message keys, you can discard them. The <span class="- topic/ph ph">Kafka
                Consumer and Kafka Multitopic Consumer origins discard</span> message keys by default. </p>
    </div>
<article class="- topic/topic concept/concept topic concept nested1" aria-labelledby="ariaid-title2" id="concept_dyb_s4b_5mb">
    <h2 class="- topic/title title topictitle2" id="ariaid-title2">Storing Message Keys</h2>
    
    <div class="- topic/body concept/conbody body conbody"><p class="- topic/shortdesc shortdesc"></p>
        <p class="- topic/p p">You can configure the <span class="- topic/ph ph">Kafka Consumer and Kafka Multitopic Consumer origins</span> to capture Kafka message keys
            and store them in records. Store message key values when you want to use them in the
            pipeline, write them to destinations, or pass them to Kafka to use as message keys. By
            default, the origins discard Kafka message keys.</p>
        <div class="- topic/p p">Kafka origins can store message key values in the following locations:<dl class="- topic/dl dl">
                
                    <dt class="- topic/dt dt dlterm">In a specified record field</dt>
                    <dd class="- topic/dd dd">Store message key values in a specified field when you want to perform
                        processing based on field values. When you store message key values in a
                        field, you can access the values easily with expression-based and
                        field-based stages, such as the Stream Selector or Field Replacer
                        processors. </dd>
                    <dd class="- topic/dd dd ddexpand">You might also store message key values in a field when you want to write
                        message key values to destinations.</dd>
                
                
                    <dt class="- topic/dt dt dlterm">In a specified record header attribute</dt>
                    <dd class="- topic/dd dd">Store message key values in a specified record header attribute when you
                        want to use the Kafka Producer to pass message key values to Kafka as Kafka
                        message keys. </dd>
                    <dd class="- topic/dd dd ddexpand">You can use <code class="+ topic/ph pr-d/codeph ph codeph">record:attribute</code> functions to access string
                        message key values from within the pipeline. You cannot use functions to
                        access Avro message key values in record header attributes because the Avro
                        data is binary.</dd>
                    <dd class="- topic/dd dd ddexpand">By default, record header attributes are not included in records when
                        records are written to destination systems. To easily write message key
                        values to destination systems, store the values in record fields. </dd>
                
                
                    <dt class="- topic/dt dt dlterm">In a specified record field and record header attribute</dt>
                    <dd class="- topic/dd dd">Store message key values in both a specified record field and a specified
                        record header attribute when you have multiple uses for message key values. </dd>
                    <dd class="- topic/dd dd ddexpand">This option enables easy access to message key values in record fields and
                        allows passing message key values to Kafka as Kafka message keys. </dd>
                
            </dl></div>
    </div>
</article><article class="- topic/topic concept/concept topic concept nested1" aria-labelledby="ariaid-title3" id="concept_qrp_lmq_smb">
    <h2 class="- topic/title title topictitle2" id="ariaid-title3">Message Key Formats</h2>
    
    <div class="- topic/body concept/conbody body conbody"><p class="- topic/shortdesc shortdesc"></p>
        <p class="- topic/p p">Kafka message
            keys can be string values or Avro messages, depending on how your Kafka system is
            configured. </p>
        <p class="- topic/p p">The format of the message keys determines how message key values are stored in the
            record, and how you work with those values.</p>
    </div>
<article class="- topic/topic concept/concept topic concept nested2" aria-labelledby="ariaid-title4" id="concept_c1g_dds_smb">
    <h3 class="- topic/title title topictitle3" id="ariaid-title4">String Message Keys</h3>
    <div class="- topic/body concept/conbody body conbody">
        <p class="- topic/p p">When Kafka message keys are string values, the string values
            are simply written to the specified record field or record header attribute, as
            expected. </p>
        <div class="- topic/p p">The expression that you use to access message key values differs depending on where the
            values are stored:<dl class="- topic/dl dl">
                
                    <dt class="- topic/dt dt dlterm">In record fields</dt>
                    <dd class="- topic/dd dd">To access message key values stored in a field, use the
                            <code class="+ topic/ph pr-d/codeph ph codeph">record:value</code> function, as
                        follows:<pre class="+ topic/pre pr-d/codeblock pre codeblock"><code>${record:value('/&lt;message key field name&gt;')}</code></pre></dd>
                    <dd class="- topic/dd dd ddexpand">Specify the field where message key values are stored, as defined in the
                        Kafka origin. By default, Kafka origins use the following field path:
                            <code class="+ topic/ph pr-d/codeph ph codeph">/kafkaMessageKey</code>.</dd>
                
                
                    <dt class="- topic/dt dt dlterm">In record header attributes</dt>
                    <dd class="- topic/dd dd">To access message key values stored in a record header attribute, use the
                            <code class="+ topic/ph pr-d/codeph ph codeph">record:attribute</code> function, as follows:
                        <pre class="+ topic/pre pr-d/codeblock pre codeblock"><code>${record:attribute('&lt;message key attribute name&gt;'}</code></pre>Specify
                        the name of the attribute where message key values are stored, as defined in
                        the Kafka origin. By default, Kafka origins use the following attribute
                        name: <code class="+ topic/ph pr-d/codeph ph codeph">kafkaMessageKey</code>.</dd>
                
            </dl></div>
    </div>
</article><article class="- topic/topic concept/concept topic concept nested2" aria-labelledby="ariaid-title5" id="concept_mhl_3ds_smb">
    <h3 class="- topic/title title topictitle3" id="ariaid-title5">Avro Message Keys</h3>
    
    <div class="- topic/body concept/conbody body conbody"><p class="- topic/shortdesc shortdesc"></p>
        <div class="- topic/p p">When Kafka message keys are Avro messages, the message key
            values are handled differently depending on where they are stored:<dl class="- topic/dl dl">
                
                    <dt class="- topic/dt dt dlterm">In record fields</dt>
                    <dd class="- topic/dd dd">When you store Avro message key values in a field, the origin converts the
                        binary Avro message key to a map and writes it to the specified field. </dd>
                    <dd class="- topic/dd dd ddexpand">Store Avro message key values in a field when you want to use message key
                        values within a pipeline. You can access data within the map as you would
                        any other map field. </dd>
                    <dd class="- topic/dd dd ddexpand">For example, to access string data in a first level <code class="+ topic/ph pr-d/codeph ph codeph">info</code>
                        field in the <code class="+ topic/ph pr-d/codeph ph codeph">kafkaMessageKey</code> map field, you might use the
                        following
                        expression:<pre class="+ topic/pre pr-d/codeblock pre codeblock"><code>${record:value('/kafkaMessageKey/info')}</code></pre></dd>
                
                
                    <dt class="- topic/dt dt dlterm">In record header attributes</dt>
                    <dd class="- topic/dd dd">When you store Avro message key values in a record header attribute, the
                        origin performs the following tasks:<ul class="- topic/ul ul" id="concept_mhl_3ds_smb__ul_vt3_xdb_5mb" data-ofbid="concept_mhl_3ds_smb__ul_vt3_xdb_5mb">
                            <li class="- topic/li li">Stores the Avro schema in an <code class="+ topic/ph pr-d/codeph ph codeph">avroKeySchema</code>
                                attribute.</li>
                            <li class="- topic/li li">Encodes the binary Avro message key using Base64, then stores it in
                                the specified attribute.</li>
                        </ul></dd>
                    <dd class="- topic/dd dd ddexpand">Store Avro message key values in a record header attribute when you want to
                        pass the message key values to Kafka as Kafka message keys. </dd>
                
            </dl></div>
        <div class="- topic/p p">
            <div class="- topic/note note tip note_tip"><span class="note__title">Tip:</span> To perform processing within a pipeline using Avro message key values,
                store them as record fields. To pass Avro message keys to Kafka as Kafka message
                keys, store them in record header attributes. To perform both tasks, store them in
                both locations.</div>
        </div>
    </div>
</article></article><article class="- topic/topic concept/concept topic concept nested1" aria-labelledby="ariaid-title6" id="concept_kdj_kzf_tmb">
    <h2 class="- topic/title title topictitle2" id="ariaid-title6">Passing Key Values to Kafka</h2>
    
    <div class="- topic/body concept/conbody body conbody"><p class="- topic/shortdesc shortdesc"></p>
        <p class="- topic/p p">You can configure the Kafka Producer destination to pass
            message key values stored in record header attributes to Kafka to be used as message
            keys. This enables Kafka to use existing message keys instead of creating new keys for
            the records. </p>
        <div class="- topic/p p">To configure the destination to pass message key values to Kafka, configure the following
                properties:<ul class="- topic/ul ul" id="concept_kdj_kzf_tmb__ul_wkr_4pc_5mb" data-ofbid="concept_kdj_kzf_tmb__ul_wkr_4pc_5mb">
                <li class="- topic/li li">Kafka Message Key property on the Kafka tab - Define an expression that
                    indicates the location of the message key values in the records. </li>
                <li class="- topic/li li">Message Key Format property on the Data format tab - Select the format of the
                    message key values: String or Avro. </li>
            </ul></div>
        <div class="- topic/p p">
            <div class="- topic/note note tip note_tip"><span class="note__title">Tip:</span> When you select the Message Key Format property, the destination
                provides a default expression in the Kafka Message Key property that you can edit as
                needed.</div>
        </div>
        <div class="- topic/p p">The expression that you use in the Kafka Message Key property depends on the data format
            of the original message keys: <dl class="- topic/dl dl">
                
                    <dt class="- topic/dt dt dlterm">String</dt>
                    <dd class="- topic/dd dd">For string message keys, use the following expression for the Kafka Message
                        Key property:</dd>
                    <dd class="- topic/dd dd ddexpand">
                        <pre class="+ topic/pre pr-d/codeblock pre codeblock"><code>${record:attribute('&lt;message key attribute name&gt;'}</code></pre>
                    </dd>
                    <dd class="- topic/dd dd ddexpand">Specify the name of the attribute where message key values are stored, as
                        defined in the Kafka origin. By default, Kafka origins use the following
                        attribute name: <code class="+ topic/ph pr-d/codeph ph codeph">kafkaMessageKey</code>.</dd>
                
                
                    <dt class="- topic/dt dt dlterm">Avro</dt>
                    <dd class="- topic/dd dd">For Avro message keys, use the following expression for the Kafka Message
                        Key
                        property:<pre class="+ topic/pre pr-d/codeblock pre codeblock"><code>${avro:decode(record:attribute('avroKeySchema'),base64:decodeBytes(record:attribute('&lt;messsage key attribute name')))}</code></pre></dd>
                    <dd class="- topic/dd dd ddexpand">The first part of the expression defines the location of the schema for Avro
                        message keys. Do not change this part of the expression.</dd>
                    <dd class="- topic/dd dd ddexpand">The second part of the expression defines where the message key values are
                        stored. Specify the name of the attribute where message key values are
                        stored, as defined in the Kafka origin. By default, Kafka origins use the
                        following attribute name: <code class="+ topic/ph pr-d/codeph ph codeph">kafkaMessageKey</code>.</dd>
                
            </dl></div>
    </div>
</article><article class="- topic/topic concept/concept topic concept nested1" aria-labelledby="ariaid-title7" id="concept_jrn_smb_5mb">
    <h2 class="- topic/title title topictitle2" id="ariaid-title7">Example: Storing and Passing Kafka Message Keys</h2>
    
    <div class="- topic/body concept/conbody body conbody"><p class="- topic/shortdesc shortdesc"></p>
        <p class="- topic/p p">Say you want to use string Kafka message key values to route records to different
            processing streams. Then, after all pipeline processing is complete, you want to write
            records to a different Kafka topic and you want the resulting messages to use the
            original message keys. </p>
        <div class="- topic/p p">To do this, <span class="- topic/ph ph">use either the Kafka Consumer or Kafka Multitopic Consumer
                origin. Then, on the Kafka tab</span>: <ul class="- topic/ul ul" id="concept_jrn_smb_5mb__ul_pg2_5cg_vmb" data-ofbid="concept_jrn_smb_5mb__ul_pg2_5cg_vmb">
                <li class="- topic/li li">Set the Key Capture Mode property to Record Header and Field. </li>
                <li class="- topic/li li">Use the default value for the Key Capture Field property,
                        <code class="+ topic/ph pr-d/codeph ph codeph">/kafkaMessageKey</code>.</li>
                <li class="- topic/li li">Use the default value for the Key Capture Header Attribute property,
                        <code class="+ topic/ph pr-d/codeph ph codeph">kafkaMessageKey</code>. </li>
            </ul></div>
        <p class="- topic/p p">This enables the origin to capture and store the Kafka message keys in the specified
            field and attribute. </p>
        <p class="- topic/p p">Then, add a Stream Selector to the pipeline to route data to different processing streams
            based on the values in the <code class="+ topic/ph pr-d/codeph ph codeph">/kafkaMessageKey</code> field path.</p>
        <div class="- topic/p p">To write the data and pass message key values to Kafka, add a Kafka Producer destination,
            and then: <ul class="- topic/ul ul" id="concept_jrn_smb_5mb__ul_hxv_cdg_vmb" data-ofbid="concept_jrn_smb_5mb__ul_hxv_cdg_vmb">
                <li class="- topic/li li">On the Data Format tab of the destination, select String for the Message Key
                    Format property. </li>
                <li class="- topic/li li">On the Kafka tab, verify that the default expression for the Kafka Message Key
                    property provides message key values to Kafka:
                        <code class="+ topic/ph pr-d/codeph ph codeph">${record:value('/kafkaMessageKey')}</code>.</li>
            </ul></div>
        <p class="- topic/p p">This enables the Kafka Producer to pass message key values stored in the
                <code class="+ topic/ph pr-d/codeph ph codeph">kafkaMessageKey</code> record header attribute to Kafka to be used as
            message keys. </p>
    </div>
</article></article></article></main></div>

                        
                        
                        


                    </div>
                    
                </div>
            </div>


        </div> <nav class="navbar navbar-default wh_footer" data-whc_version="25.0">
  <div class=" footer-container  mx-auto">
    <!-- script for Data Collector, all flavors, but only used when accessed directly, not from portal --><script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-60917135-3', 'auto');
  ga('send', 'pageview');
</script>
  </div>
</nav>

        
        <div id="go2top">
            <span class="oxy-icon oxy-icon-up"></span>
        </div>
        
        <!-- The modal container for images -->
        <div id="modal_img_large" class="modal">
            <span class="close oxy-icon oxy-icon-remove"></span>
            <!-- Modal Content (The Image) -->
            <div id="modal_img_container"></div>
            <!-- Modal Caption (Image Text) -->
            <div id="caption"></div>
        </div>
        
        
        Â© 2023 StreamSets, Inc.

    </body>
</html>